package com.direct.ssh.service.impl;

import javax.annotation.Resource;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.direct.ssh.dao.PowerDao;
import com.direct.ssh.domain.Power;
import com.direct.ssh.service.PowerService;

@Component("powerService")
public class PowerServiceImpl implements PowerService {
	@Resource
	private SessionFactory sessionFactory;
	
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	protected Session getSession() {
		return sessionFactory.getCurrentSession();
	}
	@Resource
	private PowerDao powerDao;

	public void setPowerDao(PowerDao powerDao) {
		this.powerDao = powerDao;
	}
	@Override
	public Power querySingle(String id) {
		return powerDao.queryById(Power.class, id);
	}
	
}
